import React, { Component } from 'react';
import  $  from 'jquery';
import  Domains from '../config/Domains';

var Ajax = {

    send: function (url,pramas,type,success,beforeSend) {
        var datas = null;

        $.ajax({
            url:url,
            data:pramas,
            dataType:"json",
            type:type,
            async:false,
            success:function(data){
              if(typeof  success !='undefined'){
                success(data.data);
              }

            },
            beforeSend:function(){
              if(typeof  beforeSend !='undefined'){
                beforeSend();
              }
            }
        })
      return datas;
    },

    post :function(url,pramas,success,beforeSend){
      url = Domains.ssl+Domains.clent+'/'+url;
      this.send(url,pramas,'POST',success,beforeSend);
    }


}
export  default Ajax
